/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package weixinkeji.dev.dc.base.scheme.combo.sql;

import sys.wx.ann.AF;
import weixinkeji.dev.dc.base.food.bean.Food;
import weixinkeji.dev.dc.base.food.bean.Series;
import weixinkeji.dev.dc.base.scheme.combo.bean.ComboB;
import weixinkeji.dev.dc.base.unit.bean.Unit;

/**
 *
 * @author IMY
 */
public class ComboBSQL {

    
    public static final String COMBO_ID = "?1";
    
    /**
     *
     * 根据套餐头的combo_id,查询套餐清单时用<p>
     * 查询的字段与weixinkeji.dev.dc.base.scheme.combo.bean.ComboBView的字段一一对应<p>
     * 【ComboBSQL.COMBO_ID的值】需要替换成 'ss','ss1','ww2'类型的id数据。必须是combo_id<p>
     * 注意，CB\FOOD\SS\UNIT 这是对应表的别名<p>
     * ComboB套餐清单 CB<P>
     * Food食物 FOOD<P>
     * Series食物所属系列 SS<P>
     * Unit单位 UNIT
     */
    public static final String SQL_ComboBView_IN
            = "SELECT 	CB.*,FOOD.food_name,FOOD.food_code,FOOD.food_img,SS.*,UNIT.*"
            + " FROM (SELECT * FROM " + AF.getTC(ComboB.class).talbeName + " WHERE combo_id IN(" + COMBO_ID + ")) CB"
            + "	LEFT JOIN " + AF.getTC(Food.class).talbeName + " FOOD ON CB.food_id=FOOD.food_id"
            + "	LEFT JOIN " + AF.getTC(Series.class).talbeName + " SS ON FOOD.series_id=SS.series_id"
            + "	LEFT JOIN " + AF.getTC(Unit.class).talbeName + " UNIT ON FOOD.unit_id=UNIT.unit_id ";
}
